home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / beos / PPBeDevKit.ZIP / PLAYERPR.TAR / PlayerPRO / Source / Be-FileUtils.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-26  |  2.3 KB  |  138 lines

  1. /********************                        ***********************/
  2. //
  3. //    Player PRO 5.0 -- MAD Class for BeOS -
  4. //
  5. //    Library Version 5.0
  6. //
  7. //    To use with MAD Library for BeOS: CodeWarrior
  8. //
  9. //    Antoine ROSSET
  10. //    16 Tranchees
  11. //    1206 GENEVA
  12. //    SWITZERLAND
  13. //
  14. //    Thank you for your interest in PlayerPRO !
  15. //
  16. //    Special Thanks to:
  17. //
  18. //    Dario Accornero <adario@cs.bu.edu>
  19. //
  20. //    For his BeOS support and help!
  21. //
  22. //    FAX:            (+41 22) 346 11 97
  23. //    PHONE:             (+41 79) 203 74 62
  24. //    Internet:         rossetantoine@bluewin.ch
  25. //
  26. /********************                        ***********************/
  27.  
  28. #include "RDriver.h"
  29. #include "FileUtils.h"
  30.  
  31. void iFileCreate( Ptr AlienFileName, long)
  32. {
  33. }
  34.  
  35. FILE* iFileOpen( Ptr name)
  36. {
  37.     return fopen( name, "rb");
  38. }
  39.  
  40. long iGetEOF( FILE* iFileRefI)
  41. {
  42.     long curEOF;
  43.     
  44.     fseek( iFileRefI, 0, SEEK_END);
  45.     curEOF = ftell( iFileRefI);
  46.     fseek( iFileRefI, 0, 0);
  47.     
  48.     return curEOF;
  49. }
  50.  
  51. OSErr iRead( long size, Ptr dest, FILE* iFileRefI)
  52. {
  53.     fread( dest, size, 1, iFileRefI);
  54.     
  55.     return noErr;
  56. }
  57.  
  58. OSErr iSeekCur( long size, FILE* iFileRefI)
  59. {
  60.     return fseek( iFileRefI , size, SEEK_CUR);
  61. }
  62.  
  63. OSErr iWrite( long size, Ptr dest, FILE* iFileRefI)
  64. {
  65.     fwrite( dest, size, 1, iFileRefI);
  66.     
  67.     return noErr;
  68. }
  69.  
  70. void iClose( FILE* iFileRefI)
  71. {
  72.     fclose( iFileRefI);
  73. }
  74.  
  75. //    DA on 9/9/98
  76.  
  77. void MOT32( void *msg_buf)
  78. {
  79.     uint32    *theDataPtr = (uint32*)msg_buf;
  80.     uint32    theData = *theDataPtr;
  81.     theData = B_BENDIAN_TO_HOST_INT32( theData );
  82.     *theDataPtr = theData;
  83. }
  84.  
  85. //    DA on 9/9/98
  86.  
  87. void MOT16( void *msg_buf)
  88. {
  89.     uint16    *theDataPtr = (uint16*)msg_buf;
  90.     uint16    theData = *theDataPtr;
  91.     theData = B_BENDIAN_TO_HOST_INT16( theData );
  92.     *theDataPtr = theData;
  93. }
  94.  
  95. //    DA on 9/9/98
  96.  
  97. void INT32( void *msg_buf)
  98. {
  99.     uint32    *theDataPtr = (uint32*)msg_buf;
  100.     uint32    theData = *theDataPtr;
  101.     theData = B_LENDIAN_TO_HOST_INT32( theData );
  102.     *theDataPtr = theData;
  103. }
  104.  
  105. //    DA on 9/9/98
  106.  
  107. void INT16( void *msg_buf)
  108. {
  109.     uint16    *theDataPtr = (uint16*)msg_buf;
  110.     uint16    theData = *theDataPtr;
  111.     theData = B_LENDIAN_TO_HOST_INT16( theData );
  112.     *theDataPtr = theData;
  113. }
  114.  
  115. Ptr MADstrcpy( Ptr dst, const char* src)
  116. {
  117.     long i = 0;
  118.     
  119.     do
  120.     {
  121.         dst[ i] = src[ i];
  122.     }while( src[ i++]);
  123.     
  124.     return dst;
  125. }
  126.  
  127. int MADstrcmp( const char *dst, const char* src)
  128. {
  129.     long i = 0;
  130.     
  131.     do
  132.     {
  133.         if( dst[ i] != src[ i]) return -1;
  134.     }while( src[ i++]);
  135.     
  136.     return 0;
  137. }
  138.